package org.vaadinpa.data;

import org.vaadinpa.logic.Ticker;

public class NewsItem {

	public final int tick;
	public final String caption;
	public final String message;

	public boolean read = false;

	public NewsItem(String caption, String msg) {

		tick = Ticker.currentTick;

		this.caption = caption;
		message = msg;
	}

	public String produceHTML() {
		return "Tick " + tick + ": <b>" + caption + ":</b><br>" + message;
	}

	public void serialize(StringBuilder sb) {
		sb.append("<news tick=\"" + tick + "\" caption=\"" + caption + "\" message=\"" + message + "\" read=\"" + read
				+ "\"/>\n");
	}
}
